<!DOCTYPE html>
<html>
<head>
    <title>数字比较</title>
</head>
<body>
    <input type="number" id="num1">
    <input type="number" id="num2">
    <button onclick="compare()">比较</button>
    <p id="result"></p>

    <script>
        function compare() {
            const num1 = parseFloat(document.getElementById('num1').value);
            const num2 = parseFloat(document.getElementById('num2').value);
            let result = "";
            
            if(num1 > num2) result = "第一个数更大";
            else if(num1 < num2) result = "第二个数更大";
            else result = "两数相等";
            
            document.getElementById('result').innerText = result;
        }
    </script>
</body>
</html>